// import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "MySqlOptimizeStatement.h"
#include "../../../../ast/statement/SQLExprTableSource.h"
#include "../../visitor/MySqlASTVisitor.h"
#include "../../../../../utils/listTran.h"

MySqlOptimizeStatement::MySqlOptimizeStatement()
{
  tableSources = std::make_shared<std::list<SQLExprTableSource_ptr>>();
}
void MySqlOptimizeStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlOptimizeStatement)))
  {
    SQLObject_list_ptr tmp = ListTran::tran_class<SQLExprTableSource, SQLObject>(tableSources);
    acceptChild(visitor, tmp);
  }
  visitor->endVisit(SharedObject(MySqlOptimizeStatement));
}

BOOL_ptr MySqlOptimizeStatement::isNoWriteToBinlog()
{
  return noWriteToBinlog;
}

void MySqlOptimizeStatement::setNoWriteToBinlog(BOOL_ptr noWriteToBinlog)
{
  this->noWriteToBinlog = noWriteToBinlog;
}

BOOL_ptr MySqlOptimizeStatement::isLocal()
{
  return local;
}

void MySqlOptimizeStatement::setLocal(BOOL_ptr local)
{
  this->local = local;
}

SQLExprTableSource_list_ptr MySqlOptimizeStatement::getTableSources()
{
  return tableSources;
}

void MySqlOptimizeStatement::addTableSource(SQLExprTableSource_ptr tableSource)
{
  if (tableSource != nullptr)
  {
    tableSource->setParent(SharedObject(MySqlOptimizeStatement));
  }
  this->tableSources->push_back(tableSource);
}
